<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class CreateUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user', function (Blueprint $table) {
            $table->increments('id');
            $table->string('user_name')->comment('用户名')->default('');
            $table->string('user_coin')->comment('用户余额')->default('0');
            $table->decimal('withdraw')->comment('提现余额')->default(0);
            $table->string('user_password')->comment('用户密码')->default('');
            $table->string('user_salt')->comment('盐值')->default('0');
            $table->string('user_sign')->comment('签名')->default('');
            $table->timestamp('user_reg_time')->comment('注册时间')->default(DB::raw('CURRENT_TIMESTAMP'));
            $table->timestamp('user_last_login_time')->comment('上次登录时间')->default(DB::raw('CURRENT_TIMESTAMP'));
            $table->timestamp('user_birthday')->comment('生日')->default(DB::raw('CURRENT_TIMESTAMP'));
            $table->string('user_sex')->comment('性别 1男 2女')->default('1');
            $table->string('user_nickname')->comment('昵称')->default('');
            $table->string('user_avatar')->comment('头像')->default('');
            $table->string('user_token')->comment('令牌')->default('');
            $table->string('union_id')->comment('union_id')->default('');
            $table->string('open_id')->comment('open_id')->default('');
            $table->string('is_push')->comment('is_push')->default('');
            $table->string('user_score')->comment('积分')->default('');
            $table->string('defaultAddress')->comment('默认地址')->default('');
            $table->string('is_first')->comment('是否首次充值 1首冲  0不是')->default('');
            $table->string('Invite_code')->comment('邀请码')->default('');
            $table->integer('BNF_Lv1')->comment('上级  邀请受益人')->default(0);
            $table->integer('BNF_Lv2')->comment('次级  邀请受益人')->default(0);
            $table->integer('BNF_Lv3')->comment('三级  邀请受益人')->default(0);
            $table->integer('BNF_Lv4')->comment('四级  邀请受益人')->default(0);
            $table->string('login_type')->comment('登录类型  WxLogin TxLogin mobile')->default('mobile');
            $table->tinyInteger('is_disabled')->comment('是否禁用 0 禁用 1 启用')->default('0');
            $table->tinyInteger('is_vip')->comment('是否会员 0 不是 1 是')->default('0');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user');
    }
}
